/*
 * @Descripttion: 
 * @version: 
 * @Author: jiuguo.qin
 * @Date: 2019-12-20 15:20:48
 * @LastEditors: jiuguo.qin
 * @LastEditTime: 2020-03-13 16:51:03
 */

/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#ifndef _WRK_CHANNEL_H_INCLUDED_
#define _WRK_CHANNEL_H_INCLUDED_

#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>

#ifdef __cplusplus  
extern "C" {  
#endif  

#include "wrk_config.h"

typedef int  wrk_socket_t;

typedef struct {
    uint8_t         command;
    wrk_fd_t        fd;
    uint32_t        taskid;
    uint32_t      	length;
    char            name[64];
} wrk_channel_t;

wrk_int_t wrk_write_channel(wrk_socket_t s, wrk_channel_t *ch, size_t size);
wrk_int_t wrk_read_channel(wrk_socket_t s, wrk_channel_t *ch, size_t size);
void wrk_close_channel(wrk_fd_t *fd);

void recv_fd(int fds,int* pfd);
void send_fd(int fds,int fd);

#ifdef __cplusplus  
}
#endif  

#endif /* _wrk_CHANNEL_H_INCLUDED_ */
